package com.venus.mapper;

import com.venus.entity.Massage;
import com.venus.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * Created by admin on 13/10/17.
 */
public interface BaseMapper {

	@Select("select id,username,password from users where username = #{username} and is_used='y' ")
	User findByUsername(@Param("username") String username);

	@Select("select url from users_permissions_r where user_id = #{userId} and is_used='y'")
	Set<String> findPermissionsByUserId(@Param("userId") long userId);

	@Select("select r.name from users_roles_r urr,roles r where urr.role_id = r.id and urr.user_id = #{userId} and urr.is_used='y'")
	Set<String> findByRolesUserId(@Param("userId") long userId);

	List<User> findUsers(User user);

	Massage findImg(String login);
}
